// JavaScript Document
$(function () {
	initAdd();
	//提交
	$(".submit").on("click",function(){
		checkAdd();
	});
});
//初始化
function initAdd(){
	$(".first").val("");
	$(".service").val("");
	$(".detail").val("");
	$(".time").val("");
	$(".location").val("");
	$(".reason").val("");
	$(".remark").val("");
	$(".modelId").val("");
}
//检查提交
function checkAdd(){	
	var r=confirm("是否确认增加？");
	if (r==true){
		var msgObject = parent.layer.msg('处理中，请等待……', {
			icon: 16,
			shade: 0.4,
			time: waitImgTime //（如果不配置，默认是3秒）
		}, function(index){
			//do something
			parent.layer.close(index); 
		});
		Add(msgObject);
	}
}

//提交
function Add(msgObject){
	var first = $(".first").val();
	var service = $(".service").val();
	var detail = $(".detail").val();
	var time = $(".time").val();
	var location = $(".location").val();
	var reason = $(".reason").val();
	var remark = $(".remark").val();
	var modelId = $(".modelId").val();
	
	var str = 'first='+encodeURIComponent(first)+'&service='+encodeURIComponent(service)+'&detail='+encodeURIComponent(detail)+'&time='+encodeURIComponent(time)+'&location='+encodeURIComponent(location)+'&reason='+encodeURIComponent(reason)+'&remark='+encodeURIComponent(remark)+'&modelId='+encodeURIComponent(modelId);
	getOData(str,"admin/send/notice",{
		fn:function(oData){
			parent.layer.close(msgObject);
			alert("增加成功！");
		},
		fnerr:function(oData){
			parent.layer.close(msgObject);
		}
	});
}